package com.yunxin.admin.system.infra.persistence.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunxin.admin.system.infra.persistence.entity.SysRoleDO;
import com.yunxin.core.admin.domain.AdminUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;
/**
 *
 * @author zero°
 * @since 2023-05-22
 */
@Mapper
public interface SysRoleMapper extends BaseMapper<SysRoleDO> {


    /**
     * 获取最大范围的数据权限
     *
     * @param roles roles
     * @return Integer
     */
    Integer getMaximumDataScope(@Param("roles") Set<String> roles);

    List<AdminUser> userListByRoleCode(@Param("code")String code,@Param("teamId")Integer teamId);

    List<AdminUser> getUserList(@Param("code")String code,@Param("teamIds")List<Integer> teamIds);

    List<AdminUser> telephoneListBySalesmanId(@Param("code")String code,@Param("userIds")List<Integer> userIds,@Param("teamId")Integer teamId);

    List<Long> getUserRoles(@Param("userId")Long id);

    Long getRoleIdByCode(@Param("code")String code);
}
